<?php
/**
 * Created by PhpStorm.
 * User: C2
 * Date: 2016/8/10
 * Time: 16:11
 */

namespace Admin\Model;
use Think\Model;

class AceModel extends Model
{
    public function aceList()
    {
        $option['where']['a.deleted'] = array('exp','is null');
        $option['field'] = array('a.id','a.starttime','a.endtime','a.started','a.ended','a.daytime','a.worktime','a.gocity','a.gocity_name','a.prices','a.place','b.bus_type','b.bus_type_num','b.bus_num','d.driver_lang_type','d.driver_type','d.driver_num');
        $result = $this->alias('a')->join('inner join xy_driver d on a.id = d.ace_id')->join('inner join xy_bus b on a.id = b.ace_id')->select($option);
        return $result;
    }
    public function getAce($id)
    {
        $option['where']['a.id'] = array('eq',$id);
        $option['where']['a.deleted'] = array('exp','is null');
        $option['field'] = array('a.id','a.starttime','a.endtime','a.started','a.ended','a.daytime','a.worktime','a.gocity','a.gocity_name','a.prices','a.place','b.bus_type','b.bus_type_num','b.bus_num','d.driver_lang_type','d.driver_type','d.driver_num');
        $result = $this->alias('a')->join('inner join xy_driver d on a.id = d.ace_id')->join('inner join xy_bus b on a.id = b.ace_id')->find($option);
        return $result;
    }
}